<?php
	
	 error_reporting(E_ALL);
?>
 
<script>
function printData(){
window.print();
}
	 
	  
$(function(){
		var student_id =$("#student_id").val();	
		var kelas_tahun_ajaran_id =$("#kelas_tahun_ajaran_id").val();											
		var absent_date =$("#absent_date").val();	
		var absent_date_end =$("#absent_date_end").val();							
		var numberTemplate = {formatter: 'number', align: 'right', sorttype: 'number'};	 
		$("#tblData").jqGrid({
			url:'index.php?r=orangtua/siswa/report_presensi/ByStudentList',
			postData:{"student_id" :student_id,"kelas_tahun_ajaran_id" :kelas_tahun_ajaran_id,"absent_date":absent_date,"absent_date_end":absent_date_end},
			datatype: 'json',
			loadonce:true,
			mtype:"GET",
			autowidth:true,
			height:"100%",
			altRows:true,
			ignoreCase:true,
			colNames: ['Absent Date','Student ID','Student Name',  'Status','notes' ],
			colModel: [
				{name: 'absent_date', index: 'absent_date', formatter : 'date', formatoptions : {newformat : 'd M Y'},width: 50 },				 
				{name: 'sid', index: 'sid', width: 50 },				 				
				{name: 'name', index: 'name', width: 140,search:true},
				{name: 'presensi_status', index: 'presensi_status', width: 50,search:true, summaryType:'count', summaryTpl:'<b>{0} Item(s)</b>'},				
				{name: 'notes', index: 'notes'},
				 			
			],
			gridview: true,
			rownumbers: false,
			rowNum: 10,
			rowList: [10, 20, 30],
			pager: '#navTblData',
			viewrecords: true,
			caption: 'Presensi Student ',
			jsonReader : { 
				root:"model",
				repeatitems: false			
			},
			loadComplete:function(data){
				console.log(data);
			} 
		});
		$("#tblData").jqGrid('navGrid','#navTblData',{add:false,edit:false,search:false,del:false,refresh:false});
		
		//add search text
		$("#tblData").jqGrid('addSearchText',["name","presensi_status"]);
 	
	});
 
</script> 
   
 

  
<div style="float:rigth">&nbsp;
<?php 
    $this->widget('application.components.widgets.ActionBar', 
        array("menuAlign" => "right", 
            'items' => array(
                array(
                    'id' => "btnRefresh",
                    'title' => Yii::t("menu","Segarkan"),
                    'icon' => "images/action/Action-Refresh-icon.png",
                    'callback'=>"reloadPage"
                ),	 /*			
                array(
                    'id' => "btnNew",
                    'title' => Yii::t("menu","Absent"),
                    'icon' => "images/action/Actions-document-new-icon.png",
                    'callback'=>"newData"
                ),  */
                array(
                    'id' => "btnNew",
                    'title' => Yii::t("menu","Cetak"),
                    'icon' => "images/action/Actions-document-print-icon2.png",
                    'callback'=>"printData"
                ),					
                 
            ) 
        )
    );
?>
</div>	
 
 	<div style="clear:both"></div>	
 
 
    

    <input type="hidden" id="student_id" name="student_id" value="<?php echo $student_id ?>"  />    
    <input type="hidden" id="kelas_tahun_ajaran_id" name="kelas_tahun_ajaran_id" value="<?php echo $kelas_tahun_ajaran_id ?>"  />    
    <input type="hidden" id="absent_date" name="absent_date" value="<?php echo $absent_date ?>"  />    
    <input type="hidden" id="absent_date_end" name="absent_date_end" value="<?php echo $absent_date_end ?>"  />                                 
 
<div style="float:left; width:100%">    
	<table id="tblData"><tr></tr></table>
	<div id="navTblData"></div>
 </div>
  